<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>DATA REJECT GALVA DI INSP. MACHINING</title>
    </head>
    <body>

        <h2>DATA REJECT GALVA DI INSP. MACHINING</h2>

        ${msg}
        <table cellpading="1" cellspacing="1" bgcolor="#010101">
            <tr bgcolor="#c2c3c4">
                            <td>Date</td>
                            <td>Insp. Price</td>
                            <td>Rjt. Price</td>
                            <td>% Rjt</td>
                            <td>Cumm. Insp Price</td>
                            <td>Cumm. Rjt Price</td>
                            <td>% Rjt Cum</td>
                            <td></td>
                        </tr>

                        <c:set var="rjtpersen" value="0" />
                        <c:set var="cuminsp" value="0" />
                        <c:set var="cumrjt" value="0" />
                        <c:set var="cumpersen" value="0" />

                        <c:forEach items="${data}" var="data">
                            <c:set var="rjtpersen" value="${data.rjtPrice / data.inspPrice * 100}" />
                            <c:set var="cuminsp" value="${cuminsp + data.inspPrice}" />
                             <c:set var="cumrjt" value="${cumrjt + data.rjtPrice}" />
                             <c:set var="cumpersen" value="${cumrjt / cuminsp * 100}" />

                            <tr bgcolor="#f2f3f4">

                            <td>${data.date}</td>
                            <td><fmt:formatNumber type="number" value="${data.inspPrice}" pattern="#,##,##,##,###" /></td>
                            <td><fmt:formatNumber type="number" value="${data.rjtPrice}" pattern="#,##,##,##,###" /></td>
                            <td><fmt:formatNumber type="number" maxFractionDigits="1" value="${rjtpersen}" /></td>
                            <td><fmt:formatNumber type="number" value="${cuminsp}" pattern="#,##,##,##,###" /></td>
                            <td><fmt:formatNumber type="number" value="${cumrjt}" pattern="#,##,##,##,###" /></td>
                            <td><fmt:formatNumber type="number" maxFractionDigits="1" value="${cumpersen}" />
                            </td>
                            <td>
                                <a href="comp-update.htm?id=${data.id}">Edit</a>&nbsp;
                                <a href="view-comp-data.htm?id=${data.id}">Delete</a>&nbsp;
                            </td>

                        </tr>
                        </c:forEach>

                </table>
    </body>
</html>
